/**
 * Excel公式转换相关类型定义
 */

// 单个转换请求
export interface SingleConvertRequest {
  excelFormula: string;
  cellVariableMap: Record<string, string>;
}

// 批量转换请求  
export interface BatchConvertRequest {
  excelFormulas: string[];
  cellVariableMap: Record<string, string>;
}

// 验证请求
export interface ValidateRequest {
  formula: string;
}

// 单个转换响应
export interface SingleConvertResponse {
  code: number;
  data: {
    originalFormula: string;
    convertedFormula: string;
    validation?: boolean;
  };
  message: string;
  error?: string;
}

// 批量转换响应
export interface BatchConvertResponse {
  success: boolean;
  conversions: ConversionItem[];
  total: number;
  success_count: number;
  failed: number;
  errors: string[];
  report: string;
  error?: string;
}

// 转换项
export interface ConversionItem {
  index: string;
  original: string;
  converted: string;
  status: string;
  validation?: string;
  error?: string;
}

// 默认映射响应
export interface DefaultMappingResponse {
  success: boolean;
  mapping: Record<string, string>;
}

// 验证响应
export interface ValidateResponse {
  success: boolean;
  valid: boolean;
  formula: string;
  error?: string;
}

// 单元格映射项
export interface CellMappingItem {
  cellRef: string;
  variableName: string;
  description?: string;
}

/**
 * 特殊业务规则转换相关类型定义
 */

// 业务规则转换请求
export interface BusinessRuleConvertRequest {
  formula: string;
  variableName?: string;
}

// 业务规则转换响应
export interface BusinessRuleConvertResponse {
  code: number;
  data: {
    originalFormula: string;
    convertedFormula: string;
  };
  message: string;
  error?: string;
}

// 业务规则批量转换请求
export interface BusinessRuleBatchConvertRequest {
  formulas: string[];
  variableName?: string;
}

// 业务规则批量转换响应
export interface BusinessRuleBatchConvertResponse {
  code: number;
  success: boolean;
  results: BusinessRuleConversionItem[];
  total: number;
  successCount: number;
  failedCount: number;
  message?: string;
  error?: string;
}

// 业务规则转换项
export interface BusinessRuleConversionItem {
  index: number;
  original: string;
  converted: string;
  status: 'success' | 'failed';
  error?: string;
}

// 业务规则响应
export interface BusinessRulesResponse {
  code: number;
  success: boolean;
  rules: Record<string, number[]>;
  message?: string;
}

/**
 * 电器公式转换相关类型定义
 */

// 电器公式转换请求
export interface ElectricalFormulaConvertRequest {
  excelFormula: string;
}

// 电器公式转换响应
export interface ElectricalFormulaConvertResponse {
  code: number;
  data: {
    originalFormula: string;
    convertedFormula: string;
    validation: boolean;
  };
  message: string;
}

// 电器公式批量转换请求
export interface ElectricalFormulaBatchConvertRequest {
  excelFormulas: string[];
}

// 电器公式批量转换响应
export interface ElectricalFormulaBatchConvertResponse {
  code: number;
  data: {
    results: ElectricalFormulaBatchResult[];
    totalCount: number;
    successCount: number;
    failedCount: number;
    report: string;
  };
  message: string;
}

// 电器公式转换项
export interface ElectricalFormulaBatchResult {
  index: number;
  original: string;
  converted: string;
  status: string;
  validation?: string;
  error?: string;
}

// 电器公式示例响应
export interface ElectricalFormulaExampleResponse {
  code: number;
  data: {
    example: string;
    supportedFunctions: string[];
  };
  message: string;
}

// 电器公式验证响应
export interface ElectricalFormulaValidateResponse {
  code: number;
  data: {
    formula: string;
    valid: boolean;
    message: string;
  };
  message: string;
}

// 规格补全相关类型定义
export interface SpecificationCompletionToggleRequest {
  enabled: boolean;
}

export interface SpecificationCompletionToggleResponse {
  code: number;
  data: {
    specificationCompletionEnabled: boolean;
    message: string;
  };
  message: string;
}

export interface SpecificationCompletionPreviewRequest {
  formula: string;
}

export interface SpecificationCompletionPreviewResponse {
  code: number;
  data: {
    originalFormula: string;
    convertedFormula: string;
    message: string;
  };
  message: string;
} 